function Enemy(type){//敌机
	 	this.init=function(){
	 		this.body = document.createElement("div");
	 		 
	 		switch(type){
	 			case "small" : {//小飞机
	 				this.speed=10;
	 				this.hp=1;
	 				this.score=1;
	 				this.body.className="enemy-small";
	 				this.dieimgs=["plain1_die1.png","plain1_die2.png","plain1_die3.png",];
	 				new GameEngine().append(this);
	 				this.left(Math.min(new GameEngine().width()-this.width(),Math.random()*new GameEngine().width() ));
	 				this.top(-this.height());
	 					break;
	 			}
	 		
	 			case "middle" : {//中飞机
	 				this.speed=6;
	 				this.hp=3;
	 				this.score=5;
	 				this.body.className="enemy-middle";
	 				this.dieimgs=["plain2_die1.png","plain2_die2.png","plain2_die3.png","plain2_die4.png",];
	 				new GameEngine().append(this);
	 				this.left(Math.min(new GameEngine().width()-this.width(),Math.random()*(new GameEngine().width()-this.width() )));
	 				this.top(-this.height());
	 					break;
	 			}
	 			 
	 			case "large":{
					this.speed = 4;
					this.hp=10;
					this.score=10;
					this.body.className = "enemy-large";
					this.dieimgs=["plain3_die1.png","plain3_die2.png","plain3_die3.png","plain3_die4.png","plain3_die5.png","plain3_die6.png"];
					new GameEngine().append(this);
					this.left(Math.min(new GameEngine().width() - this.width(), Math.random() * (new GameEngine().width()-this.width()) ))
					this.top(-this.height());
					break;
				}		 
	 		}
	 		return this;
	 		 
	 	}
	 	this.left=function(val){
	 		if(val||val==0){
	 			this.body.style.left=val+"px";
	 		}
	 		return this.body.offsetLeft;
	 		 
	 	}
	 	this.top=function(val){
	 		if(val||val==0){
	 			this.body.style.top=val+"px";
	 		}
	 		return this.body.offsetTop;
	 	}
	 	this.width=function(){
	 		
	 		return this.body.offsetWidth;
	 	}
	 	this.height=function(){
	 		return this.body.offsetHeight;
	 	}
	 	this.move=function(){//敌机移动
	 		this.movetimer=setInterval(function(){
	 			this.top(this.top()+this.speed);
	 			if(this.top()>new GameEngine().height()){//根据判断，如果大于背景图的高度，就让其消失，同时关闭定时器
	 				clearInterval(this.movetimer);
	 				this.destroy();
	 			}
	 		}.bind(this),100);
	 		return this;
	 	}
	 	this.hurt=function(){
	 		--this.hp==0 ? this.explode() : "";
	 	}
	 	this.sumScore=document.getElementById("s1");
	 	
	 	this.explode=function(){//爆炸
	 		new GameEngine().enemes.delete(this);
	 		clearInterval(this.movetimer);
	 		new GameEngine().sum+=this.score;
	 		this.sumScore.innerHTML=new GameEngine().sum;
	 		var t=setInterval(function(){
	 			if(this.dieimgs.length==0){
	 				clearInterval(t);
	 				this.destroy();
	 				
	 				
	 			}
	 			this.body.style.background="url(images/"+this.dieimgs.shift()+")";
	 			
	 		}.bind(this),100)
	 	}
	 	this.fire=function(){//开火
	 		
	 	}
	 	this.destroy=function(){//消失
	 		
	 		this.body.remove();
	 		
	 		
	 	}
	 	//return Enemy.instance;
	}